/**
 * Created by liubin on 2015/09/01.
 */
'use strict';

import _ from 'lodash';

export default function JoiOption(field, extra) {
    let options = {
        language: {
            key: '{{key}} ',
            any: {
                empty: '不可以为空',
                required: '是必须项目'
            },
            date: {
                base: '必须是有效的日期'
            },
            number: {
                base: '必须是有效的数字',
                min: '必须大于等于{{limit}}'
            }
        }
    };
    if (extra) {
        options = _.merge(options, extra);
        //options = Object.assign(options, extra);
    }
    field = field.options(options);
    return field;
}